package java_9_9.Test_4;

import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Test_6 {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        System.out.println("请输入一个年份");
        int year=in.nextInt();
        //获取当前时间
        Calendar c=Calendar.getInstance();
        //获取当前年份
        c.set(Calendar.YEAR,year);
        //获取当前整月份
        c.set(Calendar.MONTH,5);
        //六月份最大天数
        int maxDate=c.getActualMaximum(Calendar.DATE);
        int sunDays=0;
        for (int i=1;i<=maxDate;i++){
            c.set(Calendar.DATE,i);
            //判断是周日
            if (c.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY){
                sunDays++;
            if (sunDays==3) {
                break;
            }
            }
        }
        System.out.println("父亲节是"+c.getTime());
    }
}
